import requests

url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken"
corpid = "ww32f5df9a2517b554"
corpsecret = "nuNw29ZfaeuyYVhV1qrckKSn12Z7Lmntp3whCMbJF1w"

# # 参数拼接到url里完成get接口请求
# url_new = url+"?corpid="+corpid+"&corpsecret="+corpsecret
# # print(url_new)
# rep = requests.get(url=url_new)
# print(rep.text)

# 参数传参，定义一个变量，保存接口请求的参数
my_params = {
    "corpid": corpid,
    "corpsecret": corpsecret
}
rep = requests.get(url=url, params=my_params)
print(rep.text)


# {"errcode": 0,"errmsg": "ok","access_token":"mNCN6rlhuj9JmlSKhVTktiK34X4T3wVDe5zGa3WwHHCjuLyaa1l8zFlO48PYTzHd07CiWHtMtsanQQ_OhDE4vMTIwxZAxvE301KadPjTL9gcvLiR35m0WYYLvIww3Nh_EpHkpl4UtfzjFryq1ka4IeaGQLcMbyPWYbiKVo1eRlm4sB5GOboCuwLcrB31NsAO2t6R3g0yM4IqPlt6sTLunw","expires_in":7200}
# {"errcode": 0,"errmsg": "ok","access_token":"mNCN6rlhuj9JmlSKhVTktiK34X4T3wVDe5zGa3WwHHCjuLyaa1l8zFlO48PYTzHd07CiWHtMtsanQQ_OhDE4vMTIwxZAxvE301KadPjTL9gcvLiR35m0WYYLvIww3Nh_EpHkpl4UtfzjFryq1ka4IeaGQLcMbyPWYbiKVo1eRlm4sB5GOboCuwLcrB31NsAO2t6R3g0yM4IqPlt6sTLunw","expires_in":7200}

